package batchFile;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

import constants.Constants;

public class BatchFileScale {

	/**
	 * @param args
	 */
	
	public BatchFileScale(String svm_dataset) throws IOException{
		String[] folds = {"1", "2", "3", "4", "5"};
		String[] epsilons = {"0", "05", "1", "15", "2", "25"};
		String[] svms = {"", "_"};
		String scale = ".scale";
		for(String fold : folds){
			for(String epsilon : epsilons){
				for(String svm : svms){
					BufferedWriter bw = new BufferedWriter(new FileWriter(svm_dataset+"fold-"+fold+"-train0"+epsilon+svm+".bat"));
					bw.write("..\\"+Constants.svm_train+" -h 0 -t 0 -c 32"+" fold-"+fold+"\\train0"+epsilon+svm+scale+" fold-"+fold+"\\model0"+epsilon+svm);
					bw.close();
					BufferedWriter bw2 = new BufferedWriter(new FileWriter(svm_dataset+"fold-"+fold+"-output0"+epsilon+svm+".bat"));
					if(svm == "") {
						bw2.write("..\\"+Constants.svm_predict+" fold-"+fold+"\\test0"+epsilon+svm+scale+" fold-"+fold+"\\model0"+epsilon+svm+" fold-"+fold+"\\output0"+epsilon+svm);
					}
					else {
						bw2.write("..\\"+Constants.svm_predict+" fold-"+fold+"\\test0"+epsilon+"-2"+scale+" fold-"+fold+"\\model0"+epsilon+svm+" fold-"+fold+"\\output0"+epsilon+svm);
					}
					bw2.close();
					BufferedWriter bw3 = new BufferedWriter(new FileWriter(svm_dataset+"fold-"+fold+"-scale-train0"+epsilon+svm+".bat"));
					bw3.write("..\\"+Constants.svm_scale2+" -l -1 -u 1 -s"+" fold-"+fold+"\\scale0"+epsilon+svm+" fold-"+fold+"\\train0"+epsilon+svm+" > fold-"+fold+"\\train0"+epsilon+svm+scale);
					bw3.close();
					BufferedWriter bw4 = new BufferedWriter(new FileWriter(svm_dataset+"fold-"+fold+"-scale-test0"+epsilon+svm+".bat"));
					if(svm == "") {
						bw4.write("..\\"+Constants.svm_scale2+" -r"+" fold-"+fold+"\\scale0"+epsilon+svm+" fold-"+fold+"\\test0"+epsilon+" > fold-"+fold+"\\test0"+epsilon+scale);
					}
					else {
						bw4.write("..\\"+Constants.svm_scale2+" -r"+" fold-"+fold+"\\scale0"+epsilon+svm+" fold-"+fold+"\\test0"+epsilon+"-2 > fold-"+fold+"\\test0"+epsilon+"-2"+scale);
					}
					bw4.close();
				}
			}
		}
	}

}
